﻿using CorsOption = MicroCloud.Options.CorsOption;

namespace MicroCloud.AspNetCore.Cors
{
    /// <summary>
    /// Cors跨源资源共享服务初始化器接口
    /// </summary>
    public interface ICorsInitializer
    {
        /// <summary>
        /// 获取 Cors跨域策略选项
        /// </summary>
        CorsOption CorsOptions { get; }

        /// <summary>
        /// 添加Cors跨源资源共享服务
        /// </summary>
        /// <param name="services">服务集合</param>
        /// <returns></returns>
        IServiceCollection AddCors(IServiceCollection services);
        
        /// <summary>
        /// 应用Cors跨源资源共享服务
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        IApplicationBuilder UseCors(IApplicationBuilder app);

    }
}